package com.china08.yxyapi.repository.mg;

import java.util.Date;
import java.util.List;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;

import com.china08.yxyapi.cache.annotations.YxCacheConfig;
import com.china08.yxyapi.entity.mg.platform.YxyHomeNotice;

@Cacheable
@YxCacheConfig
public interface YxyHomeNoticeRepository extends MongoRepository<YxyHomeNotice, String> {

    YxyHomeNotice findById(String id);

    List<YxyHomeNotice> findByEdbIdAndStatusOrderByCreatedDateDesc(String schoolId, int status);

    List<YxyHomeNotice> findTop6ByEdbIdAndStatusOrderByCreatedDateDesc(String schoolId, int i);

    YxyHomeNotice findByIdAndEdbIdAndStatus(String id, String schoolId, int status);

    YxyHomeNotice findTop1ByCreatedDateGreaterThanOrderByCreatedDateAsc(Date currentDate);

    YxyHomeNotice findTop1ByCreatedDateLessThanOrderByCreatedDateDesc(Date currentDate);

    YxyHomeNotice findTop1ByEdbIdAndCreatedDateGreaterThanOrderByCreatedDateAsc(String schoolId, Date currentDate);

    YxyHomeNotice findTop1ByEdbIdAndCreatedDateLessThanOrderByCreatedDateDesc(String schoolId, Date currentDate);

    YxyHomeNotice findTop1ByEdbIdAndStatusAndCreatedDateGreaterThanOrderByCreatedDateAsc(String schoolId, int status,
            Date currentDate);

    YxyHomeNotice findTop1ByEdbIdAndStatusAndCreatedDateLessThanOrderByCreatedDateDesc(String schoolId, int status,
            Date currentDate);

    Page<YxyHomeNotice> findByEdbIdAndStatus(String schoolId, int i, Pageable pageable);

    List<YxyHomeNotice> findTop8ByEdbIdAndStatusOrderByPvDesc(String schoolId, int i);

}
